package com.tencent.mapper;

import com.tencent.entity.OrderSetting;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;



import java.util.List;

/**
 * @author: Fame
 * @date: 2022-08-16 10:01
 * @description:
 */
public interface OrderSettingMapper {

    @Select("select * from t_ordersetting where orderDate between #{startDate} and #{endDate}")
    List<OrderSetting> findListByOrderDate(@Param("startDate")String startDate,@Param("endDate") String endDate);
    /**
     * 设置预约信息
     * @param orderSetting
     * @return
     */
    @Insert("insert into t_ordersetting values (null,#{orderDate},#{number},0)")
    public int insert(OrderSetting orderSetting);

    @Select("select * from t_ordersetting where orderDate = #{dateStr}")
    public OrderSetting findOneBtOrderDate(String dateStr);

    @Update("update t_ordersetting set number = #{number} where orderDate =#{orderDate}")
    public int updateNumber(@Param("number") Integer number,@Param("orderDate") String orderDate);

    @Update("update t_ordersetting set reservations = #{num} WHERE Date(orderDate) = #{orderDate}" )
    int updateReservations(@Param("num") Integer num,@Param("orderDate") String orderDate);
}


